
package main
 
import(
    "fmt"
    "reflect"
)
 
type MyStruct struct{
    name string
}
 
func (this *MyStruct)GetName() string {
    return this.name
}

func ref(s1,s2 string){
    fmt.Println("call ref: %s,%s",s1,s2)
}

func callRef(){
  //funType := reflect.Type(main.ref)
  //fun := funcName.MethodByName("ref")
 // 方法的参数
  params := make([]reflect.Value, 2)
  params[0] = reflect.ValueOf("1")
  params[1] = reflect.ValueOf("2")

  //执行方法
  //fun.Call(params)
}
func main() {
    s := "this is string"
    fmt.Println(reflect.TypeOf(s))
    fmt.Println("-------------------")
     
    fmt.Println(reflect.ValueOf(s))
    var x float64 = 3.4
    fmt.Println(reflect.ValueOf(x))
    fmt.Println("-------------------")
     
    a := new(MyStruct)
    a.name = "yejianfeng"
    
    fmt.Println(reflect.ValueOf(a))
    fmt.Println(reflect.TypeOf(a))
 
    fmt.Println("-------------------")
    b := reflect.ValueOf(a).MethodByName("GetName").Call([]reflect.Value{})
    fmt.Println(b[0]) 
    
    callRef()    
    
}
